<html>

<!-- $Id: readme.html,v 1.2 2004/02/29 20:41:21 marcus256 Exp $ -->

<head>
  <title>GLFW Readme file for MASM32</title>
</head>
<body>

<!-- TITLE -------------------------------------------------------------->
<center>
<font face="bookman old style,arial" size=+4><b>GLFW v2.5</b></font><br>
<font face="bookman old style,arial" size=+3>for MASM32</font>
</center>

<!-- CONTENTS ----------------------------------------------------------->
<p>
<center>
<table border=0><tr><td>
<b>
<ol>
 <li><a href="#sec1">Introduction</li></a>
 <li><a href="#sec2">Installing GLFW for MASM32</li></a>
 <li><a href="#sec3">Compiling the example programs</li></a>
 <li><a href="#sec4">Using GLFW from MASM32</li></a>
 <li><a href="#sec5">The author</li></a>
 <li><a href="#sec6">Acknowledgements</li></a>
</ol>
</b>
</td></tr></table>
</center>


<!----------------------------------------------------------------------->
<p><hr>
<!----------------------------------------------------------------------->

<a name="sec1">
<p><h2>1. Introduction</h2>

<p>This distribution contains MASM32 bindings for the GLFW v2.5.x Windows
DLL, and MASM32 example programs. For further information on how to use
GLFW you should read the GLFW documentation.

<p>For those of you who are unfamiliar with MASM32, it is a free 32-bit
x86 assembler for Windows, with excellent support for win32 API calls etc.
You can download MASM32 from its homepage, <a
href="http://www.masm32.com/" target="_blank">www.masm32.com</a>.

<p>I assume that the reader of this document is at least somewhat familiar
with x86 assembly language, and knows how to use MASM32.


<!----------------------------------------------------------------------->
<p><hr>
<!----------------------------------------------------------------------->

<a name="sec2">
<p><h2>2. Installing GLFW for MASM32</h2>

<p>To install GLFW for MASM32, you should copy <b>support\masm\include\glfw.inc</b>
to your MASM32 include directory, and <b>support\masm\lib\glfwdll.lib</b>
to your MASM32 lib directory.

<p>The file <b>support\win32dll\glfw.dll</b> can either be copied to your
Windows system folder (e.g. C:\WINNT\system32\ for Windows NT or
C:\WINDOWS\SYSTEM for Windows 9x/ME), or to your project directory (where
you keep your compiled EXE).

<p><b>IMPORTANT</b> Since there is a problem with how the MASM32 include
files are generated (64-bit arguments are interpreted as two 32-bit
arguments), it is necessary to replace the <b>opengl32.inc</b> and
<b>glu32.inc</b> files in your MASM32 include directory with the ones
in this distribution (<b>support\masm\include\opengl32.inc</b> and
<b>support\masm\include\glu32.inc</b>). Otherwise you will not be able to
compile the example programs, and programming OpenGL with MASM32 will not
be easy.


<!----------------------------------------------------------------------->
<p><hr>
<!----------------------------------------------------------------------->

<a name="sec3">
<p><h2>3. Compiling the example programs</h2>

<p>Assuming that you have installed GLFW as described in <a
href="#sec2">section 2</a>, you should be able to compile the example
programs by simply running <b>support\masm\examples\makeit.bat</b> (double
clicking the icon works just fine).



<!----------------------------------------------------------------------->
<p><hr>
<!----------------------------------------------------------------------->

<a name="sec4">
<p><h2>4. Using GLFW from MASM32</h2>

<p><h3>4.1 General</h3>

<p>MASM32 has very nice DLL calling support, so using GLFW should be
straight forward.

<p>In your program, you should <b>INCLUDE \masm32\include\glfw.inc</b> and
<b>INCLUDELIB \masm32\lib\glfwdll.lib</b> (paths according to the MASM32
recommendations).

<p>As you can see in the example programs, they do not specify the full
MASM32 path when including the .inc and .lib files. This is because I keep
my MASM32 installation and my project files on different drives, and I
have solved it with a (more or less) clever batch file
(<b>support\masm\examples\makeit.bat</b>). Feel free to use this batch
file as a template for building your own projects. Otherwise you should
make sure that you specify the correct include and library paths.


<p><br><h3>4.2 Calling GLFW functions</h3>

<p>To call GLFW functions you use the <b>INVOKE</b> macro, which correctly
places the function arguments on the stack, and calls the GLFW function.
The syntax is: <b>INVOKE <i>function</i>[, <i>arg1</i>[, <i>arg2</i>[,
...]]]</b>. For instance, calling <b>glfwOpenWindow</b> could look like
this:

<p>&nbsp;&nbsp;<b>INVOKE glfwOpenWindow, 640, 480, 0, 0, 0, 0, 0, 0,
GLFW_WINDOW</b>


<p><br><h3>4.3 Using GLFW callback functions</h3>

<p>In order to use GLFW callback functions, you have to make sure that
your functions are using the STDCALL calling convention.


<!----------------------------------------------------------------------->
<p><hr>
<!----------------------------------------------------------------------->

<a name="sec5">
<p><h2>5. The author</h2>

<p>My name is Marcus Geelnard, <a href="mailto:marcus.geelnard@home.se">marcus.geelnard@home.se</a>.
Please contact me if you have any problems with GLFW, or any questions at
all concerning compiling or using GLFW.

<p>The GLFW web site can be found here:
<a href="http://glfw.sourceforge.net/">http://glfw.sourceforge.net/</a>.
It contains the latest version of GLFW, news and other information that is
useful for OpenGL development.


<!----------------------------------------------------------------------->
<p><hr>
<!----------------------------------------------------------------------->

<a name="sec6">
<p><h2>6. Acknowledgements</h2>

<p>Many thanks to <b>Toni Jovanoski</b>, whose dedicated work made MASM32
support possible! He also supplied the modified opengl32.inc and glu32.inc
files.

<!----------------------------------------------------------------------->
<p><hr>
<!----------------------------------------------------------------------->

</body>
</html>
